//
//  UserManaged.swift
//  Swift_SendMessage
//
//  Created by lanou on 15/11/25.
//  Copyright © 2015年 changfengZhang. All rights reserved.
//

import UIKit

class UserManaged: NSObject {

    //定义两个私有属性
    private var userName : String?
    private var userID : String?
    //定义一个私有的类属性
    private static var user : UserManaged?
    
    //Swift中最简单也是最常用的单例类
    static func defaultManager() -> UserManaged {
        
        if user == nil {
            
            user = UserManaged()
            
        }
                
        return user!
    }
    
    func saveUser(userName : String, userId : String) {
        
        self.userName = userName
        
        self.userID = userId
        
    }
    
    func findUserSince() -> (String, String) {
        //返回一个元组，保存用户名和ID
        return (self.userName!, self.userID!)
        
    }
    
}
